<?php
/* @var $this SiteController    // Points: <?=$ccaResident->point; ?>
 * */
$this->pageTitle=Yii::app()->name;
if(!Yii::app()->user->isGuest && isset(Yii::app()->user->userModel)){
	$matric_no = Yii::app()->user->userModel->matric_no;
	$criteria = new CDbCriteria;
	$criteria->condition = "matric_no = '$matric_no'";
	$user_model = Resident::model()->find($criteria);
	$cca_count = sizeof($user_model->ccaResidents);
}

?>

<h1>Welcome to <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1>
<?php if(!Yii::app()->user->isGuest){?>
	<?php if(isset($cca_count)){?>
		<h3>You are involved in <?=$cca_count?> activities:</h3>
		<?php 
		foreach($user_model->ccaResidents as $ccaResident){
		?>
		<p>
			<h3><?php echo $ccaResident->cca->name; ?></h3>
			Role: <?=$ccaResident->role->name; ?><br/>
			Points:
		</p>
		<?php }?>
	<?php }?>
<?php }?>